package test;

import org.jing.core.lang.data.Carrier;
import org.jing.core.lang.JingException;
import org.jing.core.logger.JingLogger;

/**
 * Description: <br>
 *
 * @author bks <br>
 * @since 2020-08-24 <br>
 */
class Demo4JingLogger {
    private static final JingLogger LOGGER = JingLogger.getLogger(Demo4JingLogger.class);

    private Demo4JingLogger() throws JingException {
        long startTimestamp = System.currentTimeMillis();
        test2();
        System.out.println("cost: " + (System.currentTimeMillis() - startTimestamp));
    }

    private void test1() {
        Carrier c = new Carrier();
        c.setValue("123", "456");
        System.out.println("============================all===========================");
        LOGGER.all(c);
        LOGGER.all(new JingException("test exception"));
        LOGGER.all("123{}789{}", 456, c);
        LOGGER.all(new JingException("test exception"), "测试错误");
        LOGGER.all(new JingException("test exception"), "测试{}: {}", "错误", c);
        System.out.println("=======================================================");
        LOGGER.trace(c);
        LOGGER.trace(new JingException("test exception"));
        LOGGER.trace("123{}789{}", 456, c);
        LOGGER.trace(new JingException("test exception"), "测试错误");
        LOGGER.trace(new JingException("test exception"), "测试{}: {}", "错误", c);
        System.out.println("============================debug===========================");
        LOGGER.debug(c);
        LOGGER.debug(new JingException("test exception"));
        LOGGER.debug("123{}789{}", 456, c);
        LOGGER.debug(new JingException("test exception"), "测试错误");
        LOGGER.debug(new JingException("test exception"), "测试{}: {}", "错误", c);
        System.out.println("============================info===========================");
        LOGGER.info(c);
        LOGGER.info(new JingException("test exception"));
        LOGGER.info("123{}789{}", 456, c);
        LOGGER.info(new JingException("test exception"), "测试错误");
        LOGGER.info(new JingException("test exception"), "测试{}: {}", "错误", c);
        System.out.println("============================warn===========================");
        LOGGER.warn(c);
        LOGGER.warn(new JingException("test exception"));
        LOGGER.warn("123{}789{}", 456, c);
        LOGGER.warn(new JingException("test exception"), "测试错误");
        LOGGER.warn(new JingException("test exception"), "测试{}: {}", "错误", c);
        System.out.println("============================imp===========================");
        LOGGER.imp(c);
        LOGGER.imp(new JingException("test exception"));
        LOGGER.imp("123{}789{}", 456, c);
        LOGGER.imp(new JingException("test exception"), "测试错误");
        LOGGER.imp(new JingException("test exception"), "测试{}: {}", "错误", c);
        System.out.println("============================error===========================");
        LOGGER.error(c);
        LOGGER.error(new JingException("test exception"));
        LOGGER.error("123{}789{}", 456, c);
        LOGGER.error(new JingException("test exception"), "测试错误");
        LOGGER.error(new JingException("test exception"), "测试{}: {}", "错误", c);
        System.out.println("============================fatal===========================");
        LOGGER.fatal(c);
        LOGGER.fatal(new JingException("test exception"));
        LOGGER.fatal("123{}789{}", 456, c);
        LOGGER.fatal(new JingException("test exception"), "测试错误");
        LOGGER.fatal(new JingException("test exception"), "测试{}: {}", "错误", c);
    }

    private void test2() {
        System.out.println("============================all===========================");
        LOGGER.all("12{}6{}", 345, 789);
        LOGGER.all("12{}6{}", 345, 789);
        LOGGER.all("12{}6{}", 345, 789);
        LOGGER.all("12{}6{}", 345, 789);
        LOGGER.all("12{}6{}", 345, 789);
        System.out.println("============================trace===========================");
        LOGGER.trace("12{}6{}", 345, 789);
        LOGGER.trace("12{}6{}", 345, 789);
        LOGGER.trace("12{}6{}", 345, 789);
        LOGGER.trace("12{}6{}", 345, 789);
        LOGGER.trace("12{}6{}", 345, 789);
        System.out.println("============================debug===========================");
        LOGGER.debug("12{}6{}", 345, 789);
        LOGGER.debug("12{}6{}", 345, 789);
        LOGGER.debug("12{}6{}", 345, 789);
        LOGGER.debug("12{}6{}", 345, 789);
        LOGGER.debug("12{}6{}", 345, 789);
        System.out.println("============================info===========================");
        LOGGER.info("12{}6{}", 345, 789);
        LOGGER.info("12{}6{}", 345, 789);
        LOGGER.info("12{}6{}", 345, 789);
        LOGGER.info("12{}6{}", 345, 789);
        LOGGER.info("12{}6{}", 345, 789);
        System.out.println("============================warn===========================");
        LOGGER.warn("12{}6{}", 345, 789);
        LOGGER.warn("12{}6{}", 345, 789);
        LOGGER.warn("12{}6{}", 345, 789);
        LOGGER.warn("12{}6{}", 345, 789);
        LOGGER.warn("12{}6{}", 345, 789);
        System.out.println("============================imp===========================");
        LOGGER.imp("12{}6{}", 345, 789);
        LOGGER.imp("12{}6{}", 345, 789);
        LOGGER.imp("12{}6{}", 345, 789);
        LOGGER.imp("12{}6{}", 345, 789);
        LOGGER.imp("12{}6{}", 345, 789);
        System.out.println("============================error===========================");
        LOGGER.error("12{}6{}", 345, 789);
        LOGGER.error("12{}6{}", 345, 789);
        LOGGER.error("12{}6{}", 345, 789);
        LOGGER.error("12{}6{}", 345, 789);
        LOGGER.error("12{}6{}", 345, 789);
        System.out.println("============================fatal===========================");
        LOGGER.fatal("12{}6{}", 345, 789);
        LOGGER.fatal("12{}6{}", 345, 789);
        LOGGER.fatal("12{}6{}", 345, 789);
        LOGGER.fatal("12{}6{}", 345, 789);
        LOGGER.fatal("12{}6{}", 345, 789);
    }

    public static void main(String[] args) throws JingException {
        new Demo4JingLogger();
    }
}